
<?php
    header('Content-Type:text/html;charset=UTF-8');
    session_start();
	require('mysql.php');
	echo $studentid;
	if(isset($_POST['phonenumtext'])){
		$studentid=$_POST['usercode'];
		$phone=$_POST['phonenumtext'];
		if($_SESSION['usertype']=='s'){
		$sql=<<<SQL
		UPDATE allstudent
		SET phone="{$phone}"
		WHERE studentid="{$studentid}"
SQL;
}	elseif ($_SESSION['usertype']=='t'){
		$sql=<<<SQL
		UPDATE teach
		SET teachphone="{$phone}"
		WHERE teachid="{$studentid}"
SQL;
}
	$result=mysql_query($sql)
	or die("SQL语句执行失败！");
	if ($result){
	$state='ok';
	echo '<script>alert("成功修改手机号！");</script>';
	header("Location:../view/selfinformation.php?state=$state");
	}//ifresult		
}//if isset
	
	
?>
